package cn.ad.server.domain.ad;

import java.util.Date;

public class AdMaterialGroup {

	static final String VERSION = "0";
	static final String CACHE_NAME = "admaterialgroup";

	private long id;
	private Creative creative;
	private long creativeId;
	private AdTemplate adTemplate;
	private AdMaterial adMaterial;
	private AdTemplateSpec adTemplateSpec;
	private int status;
	private Date createTime;
	private Date updateTime;
	private int interactionType;
	private long interactionId;
	private InteractionApp interactionApp;
	private InteractionRedirects interactionRedirects;

	public static String cacheKey(long id) {
		return new StringBuilder(CACHE_NAME).append(":").append(VERSION).append(":").append(id).toString();
	}

	public String toCacheKey() {
		return new StringBuilder(CACHE_NAME).append(":").append(VERSION).append(":").append(this.getId()).toString();
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public AdTemplateSpec getAdTemplateSpec() {
		return adTemplateSpec;
	}

	public void setAdTemplateSpec(AdTemplateSpec adTemplateSpec) {
		this.adTemplateSpec = adTemplateSpec;
	}

	public Creative getCreative() {
		return creative;
	}

	public void setCreative(Creative creative) {
		this.creative = creative;
	}

	public AdTemplate getAdTemplate() {
		return adTemplate;
	}

	public void setAdTemplate(AdTemplate adTemplate) {
		this.adTemplate = adTemplate;
	}

	public AdMaterial getAdMaterial() {
		return adMaterial;
	}

	public void setAdMaterial(AdMaterial adMaterial) {
		this.adMaterial = adMaterial;
	}
	
	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public InteractionApp getInteractionApp() {
		return interactionApp;
	}

	public void setInteractionApp(InteractionApp interactionApp) {
		this.interactionApp = interactionApp;
	}

	public InteractionRedirects getInteractionRedirects() {
		return interactionRedirects;
	}

	public void setInteractionRedirects(InteractionRedirects interactionRedirects) {
		this.interactionRedirects = interactionRedirects;
	}

	public long getCreativeId() {
		return creativeId;
	}

	public void setCreativeId(long creativeId) {
		this.creativeId = creativeId;
	}

	public int getInteractionType() {
		return interactionType;
	}

	public void setInteractionType(int interactionType) {
		this.interactionType = interactionType;
	}

	public long getInteractionId() {
		return interactionId;
	}

	public void setInteractionId(long interactionId) {
		this.interactionId = interactionId;
	}

	public boolean equals(Object arg0) {
		if(arg0 instanceof AdMaterialGroup){			
			return this.id==((AdMaterialGroup)arg0).id;
		}else{
			return super.equals(arg0);
		}
	}
	
	public int hashCode() {
		return Long.valueOf(id).hashCode();
	}
}
